package com.smritimap.demo;

import android.text.TextUtils;

import com.ymxk.timestar.view.smritimap.SmritiEntity;

/**
 * Created by zxn on 2024/10/17.
 */
public class StarEntity extends SmritiEntity {

    public StarEntity(String name, int resId) {
        this.name = name;
        this.resId = resId;
    }

    public StarEntity(String name, int resId, String url) {
        this.name = name;
        this.resId = resId;
        this.starUrl = url;
    }

    private StarEntity lesserChild;
    private StarEntity lesserParent;
    public String name;
    public int resId;
    private String starUrl;
    private SmritiListRes.InheritListBean data;
    private SmritiNode node;

    public StarEntity(SmritiListRes.InheritListBean bean) {
        this(bean.getMine_node(), bean.getSecond_recipient_node(), bean.getSecond_parent_node());
        data = bean;
    }

    public StarEntity(SmritiNode mine,
                      SmritiNode second,
                      SmritiNode second_parent) {
        this.name = mine.getUser_name();
        this.starUrl = mine.getPlanet_img_url();
        this.node = mine;
        if (second != null) {
            lesserChild = new StarEntity(second, null, null);
        }
        if (second_parent != null) {
            lesserParent = new StarEntity(second_parent, null, null);
        }
    }

    @Override
    public String getStarName() {
        return name;
    }

    @Override
    public int getStarIconId() {
        return resId;
    }

    @Override
    public SmritiEntity mainChild() {
        return null;
    }

    @Override
    public SmritiEntity lesserChild() {
        return lesserChild;
    }

    @Override
    public SmritiEntity lesserParent() {
        return lesserParent;
    }

    @Override
    public String getResKey() {
        return starUrl;
    }

    @Override
    public boolean isSelf() {
//        return node != null
//                && TextUtils.equals(node.getUser_id(), "ConstantData.ttUserId");

        return TextUtils.equals(name, "齐潇潇");
        //return TextUtils.equals(name, "父亲");
        //return TextUtils.equals(name, "用户名字用户(我)");
        //return TextUtils.equals(name, "女儿");
        //return TextUtils.equals(name, "何佳钰");
    }

    @Override
    public boolean isSelfParent() {
        return data != null
                && data.getMine_node() != null
                && data.getFirst_recipient_node() != null
                && TextUtils.equals(data.getFirst_recipient_node().getUser_id(), "ConstantData.ttUserId");
    }

    public void setLesserChild(StarEntity lesserChild) {
        this.lesserChild = lesserChild;
    }

    public void setLesserParent(StarEntity lesserParent) {
        this.lesserParent = lesserParent;
    }

    public void setStarUrl(String starUrl) {
        this.starUrl = starUrl;
    }

    public SmritiListRes.InheritListBean getData() {
        return data;
    }

    public void setData(SmritiListRes.InheritListBean data) {
        this.data = data;
    }

    public SmritiNode getNode() {
        return node;
    }

    public void setNode(SmritiNode node) {
        this.node = node;
    }
}
